bitkeeper revision 1.1236.42.2 (42427e4bowK4ngPjKLA3967ZsswxjQ)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 24 Mar 2005 08:46:03 +0000 (08:46 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 24 Mar 2005 08:46:03 +0000 (08:46 +0000)
Cleanups.
Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6.11-xen-sparse/drivers/xen/console/console.c
xen/common/physdev.c
xen/drivers/char/serial.c
xen/include/xen/physdev.h

index d0948132d762d008dd6f1a4945c6b0199db8954a..fb2d1169abe0caf36c752772763fc5ae38df3060 100644 (file)
@@ -77,19 +77,18 @@ static int __init xencons_setup(char *str)
     else if ( !strncmp(str, "off", 3) )
         xc_mode = XC_OFF;
 
-    switch (xc_mode)
+    switch ( xc_mode )
     {
     case XC_SERIAL:
-       n  = simple_strtol( str+4, &q, 10 );
-       if ( q>str+4 ) xc_num = n;
-       break;
-
+        n = simple_strtol( str+4, &q, 10 );
+        if ( q > (str + 4) ) xc_num = n;
+        break;
     case XC_TTY:
-        = simple_strtol( str+3, &q, 10 );
-       if ( q>str+3 ) xc_num = n;
-       break;
+        n = simple_strtol( str+3, &q, 10 );
+        if ( q > (str + 3) ) xc_num = n;
+        break;
     }
-printk("xc_num = %d\n",xc_num);
+
     return 1;
 }
 __setup("xencons=", xencons_setup);
@@ -148,16 +147,12 @@ static void kcons_write_dom0(
 {
     int rc;
 
-    while ( count > 0 )
+    while ( (count > 0) &&
+            ((rc = HYPERVISOR_console_io(
+                CONSOLEIO_write, count, (char *)s)) > 0) )
     {
-        if ( (rc = HYPERVISOR_console_io(CONSOLEIO_write,
-                                         count, (char *)s)) > 0 )
-        {
-            count -= rc;
-            s += rc;
-        }
-       else
-           break;
+        count -= rc;
+        s += rc;
     }
 }
 
@@ -194,8 +189,8 @@ void xen_console_init(void)
             xc_mode = XC_SERIAL;
         kcons_info.write = kcons_write_dom0;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-       if ( xc_mode == XC_SERIAL )
-           kcons_info.flags |= CON_ENABLED;
+        if ( xc_mode == XC_SERIAL )
+            kcons_info.flags |= CON_ENABLED;
 #endif
     }
     else
@@ -209,14 +204,14 @@ void xen_console_init(void)
     {
     case XC_SERIAL:
         strcpy(kcons_info.name, "ttyS");
-       if ( xc_num == -1 ) xc_num = 0;
-       break;
+        if ( xc_num == -1 ) xc_num = 0;
+        break;
 
     case XC_TTY:
         strcpy(kcons_info.name, "tty");
-       if ( xc_num == -1 ) xc_num = 1;
-       break;
-       
+        if ( xc_num == -1 ) xc_num = 1;
+        break;
+
     default:
         return __RETCODE;
     }
@@ -261,7 +256,7 @@ void xencons_force_flush(void)
      * We use dangerous control-interface functions that require a quiescent
      * system and no interrupts. Try to ensure this with a global cli().
      */
-    local_irq_disable();       /* XXXsmp */
+    local_irq_disable(); /* XXXsmp */
 
     /* Spin until console data is flushed through to the domain controller. */
     while ( (wc != wp) && !ctrl_if_transmitter_empty() )
@@ -502,8 +497,10 @@ static inline int __xencons_put_char(int ch)
 }
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-static int xencons_write(struct tty_struct *tty, const unsigned char *buf,
-                        int count)
+static int xencons_write(
+    struct tty_struct *tty,
+    const unsigned char *buf,
+    int count)
 {
     int i;
     unsigned long flags;
@@ -525,8 +522,11 @@ static int xencons_write(struct tty_struct *tty, const unsigned char *buf,
     return i;
 }
 #else
-static int xencons_write(struct tty_struct *tty, int from_user,
-                        const u_char *buf, int count)
+static int xencons_write(
+    struct tty_struct *tty, 
+    int from_user,
+    const u_char *buf, 
+    int count)
 {
     int i;
     unsigned long flags;
@@ -669,7 +669,7 @@ static int xennullcon_dummy(void)
     return 0;
 }
 
-#define DUMMY  (void *)xennullcon_dummy
+#define DUMMY (void *)xennullcon_dummy
 
 /*
  *  The console `switch' structure for the dummy console
index 83dce4d4a7712b7e1f97f44d26bfbe5ab98be28d..a1f182e8c8794e21f7c7623b4cb85245450b73c3 100644 (file)
@@ -105,18 +105,12 @@ static int setup_ioport_memory_access(struct domain *d, struct pci_dev *pdev)
     return 0;
 }
 
-void physdev_modify_ioport_access_range( struct domain *d, int enable, 
-                                 int port, int num )
+void physdev_modify_ioport_access_range(
+    struct domain *d, int enable, int port, int num)
 {
     int i;
-    ASSERT( d->arch.iobmp_mask );
-    for ( i = port; i < port+num; i++ )
-    {
-        if(enable)
-            clear_bit(i, d->arch.iobmp_mask);
-        else
-            set_bit(i, d->arch.iobmp_mask);
-    }
+    for ( i = port; i < (port + num); i++ )
+        (enable ? clear_bit : set_bit)(i, d->arch.iobmp_mask);
 }
 
 /* Add a device to a per-domain device-access list. */
index e9eb6eff2f08413da92cb84267a34911b2ceb94b..8db47dc90392287da81b4db335906dee982076a5 100644 (file)
@@ -480,19 +480,12 @@ void serial_force_unlock(int handle)
         uart->lock = SPIN_LOCK_UNLOCKED;
 }
 
-void serial_endboot()
+void serial_endboot(void)
 {
     int i;
-
-    for (i=0;i<sizeof(com)/sizeof(struct uart);i++)
-    {
-        if( UART_ENABLED(&com[i]) )
-        {
-            /* remove access */
-            physdev_modify_ioport_access_range( dom0, 0, com[i].io_base, 8 );
-        }
-    }
-    
+    for ( i = 0; i < ARRAY_SIZE(com); i++ )
+        if ( UART_ENABLED(&com[i]) )
+            physdev_modify_ioport_access_range(dom0, 0, com[i].io_base, 8);
 }
 
 /*
index e05868735dc17869f92949de2f605bae1565c06f..9f1fc6cde83f252244fc034e9f9a26f7570220eb 100644 (file)
@@ -7,11 +7,11 @@
 
 #include <public/physdev.h>
 
-void physdev_modify_ioport_access_range( struct domain *d, int enable, 
-                                 int port, int num );
+void physdev_modify_ioport_access_range(
+    struct domain *d, int enable, int port, int num );
 void physdev_destroy_state(struct domain *d);
-int physdev_pci_access_modify(domid_t dom, int bus, int dev, int func, 
-                              int enable);
+int physdev_pci_access_modify(
+    domid_t dom, int bus, int dev, int func, int enable);
 int domain_iomem_in_pfn(struct domain *p, unsigned long pfn);
 long do_physdev_op(physdev_op_t *uop);
 void physdev_init_dom0(struct domain *d);